'''
Created on Aug 30, 2012

@author: kingsfield
'''
def test(outfile, st, ed, pname):
    with open('/home/kingsfield/Desktop/kaggle/kaggle/out/test') as fr:
        with open(outfile, 'w') as fw:
            #fw.write('sku\n')
            line = fr.readline()
            idx = 1
            sum_line = ed - st
            step = sum_line / 100
            while True:
                line = fr.readline()
                idx += 1
                if idx < st:
                    continue
                if idx > ed:
                    break
                #print '%s----%d' % (pname, idx)
                outline = line
                fw.write(outline)

if __name__ == '__main__':
    test('/home/kingsfield/Desktop/kaggle/kaggle/out/1', 1, 5, 'aaa')
    test('/home/kingsfield/Desktop/kaggle/kaggle/out/2', 6, 10, 'bbb')
